export default function access(initialState) {
  const { currentUser } = initialState || {};

  const permissionList = !!currentUser && currentUser.data?.permissionList

  return {
    addOilStock: permissionList.addOilStock === 1,
    assignPermission: permissionList.assignPermission === 1,
    assignUserPermission: permissionList.assignUserPermission === 1,
    createMenu: permissionList.createMenu === 1,
    createOil: permissionList.createOil === 1,
    createPermission: permissionList.createPermission === 1,
    createProvider: permissionList.createProvider === 1,
    createRole: permissionList.createRole === 1,
    createSupplier: permissionList.createSupplier === 1,
    createUser: permissionList.createUser === 1,
    deleteProvider: permissionList.deleteProvider === 1,
    deleteSupplier: permissionList.deleteSupplier === 1,
    deleteUser: permissionList.deleteUser === 1,
    getMenuInfo: permissionList.getMenuInfo === 1,
    getMenuList: permissionList.getMenuList === 1,
    getMenuSearchResult: permissionList.getMenuSearchResult === 1,
    getMyUserMailInfo: permissionList.getMyUserMailInfo === 1,
    getMyUserMailList: permissionList.getMyUserMailList === 1,
    getOilInfo: permissionList.getOilInfo === 1,
    getOilList: permissionList.getOilList === 1,
    getOilStockLog: permissionList.getOilStockLog === 1,
    getPermissionInfo: permissionList.getPermissionInfo === 1,
    getPermissionList: permissionList.getPermissionList === 1,
    getProviderInfo: permissionList.getProviderInfo === 1,
    getProviderList: permissionList.getProviderList === 1,
    getRoleInfo: permissionList.getRoleInfo === 1,
    getRoleList: permissionList.getRoleList === 1,
    getRolePermissionList: permissionList.getRolePermissionList === 1,
    getSupplierInfo: permissionList.getSupplierInfo === 1,
    getSupplierList: permissionList.getSupplierList === 1,
    getSupplierSearchResult: permissionList.getSupplierSearchResult === 1,
    getUserInfo: permissionList.getUserInfo === 1,
    getUserList: permissionList.getUserList === 1,
    getUserMailInfo: permissionList.getUserMailInfo === 1,
    getUserMailList: permissionList.getUserMailList === 1,
    getUserPermissionList: permissionList.getUserPermissionList === 1,
    getUserRoleList: permissionList.getUserRoleList === 1,
    getUserSearchResult: permissionList.getUserSearchResult === 1,
    getUserinfoByToken: permissionList.getUserinfoByToken === 1,
    logout: permissionList.logout === 1,
    reduceOilStock: permissionList.reduceOilStock === 1,
    resetUserPsd: permissionList.resetUserPsd === 1,
    setRole: permissionList.setRole === 1,
    tongjiOil: permissionList.tongjiOil === 1,
    tongjiProvider: permissionList.tongjiProvider === 1,
    tongjiSupplier: permissionList.tongjiSupplier === 1,
    updateMenu: permissionList.updateMenu === 1,
    updateOil: permissionList.updateOil === 1,
    updatePermission: permissionList.updatePermission === 1,
    updateProvider: permissionList.updateProvider === 1,
    updateRole: permissionList.updateRole === 1,
    updateSupplier: permissionList.updateSupplier === 1,
    updateUser: permissionList.updateUser === 1,
    updateUserPsd: permissionList.updateUserPsd === 1,
    outLockStock: permissionList.outLockStock === 1,
    getLockList: permissionList.getLockList === 1,
    lockStock: permissionList.lockStock === 1,
    unlockStock: permissionList.unlockStock === 1,
    getSupplierByPro: permissionList.getSupplierByPro === 1,
    getLockDetailList: permissionList.getLockDetailList === 1,
    transOilStock: permissionList.transOilStock === 1,
    getInStockList: permissionList.getInStockList === 1,
    tongjiOrder: permissionList.tongjiOrder === 1,
    lossOilStock: permissionList.lossOilStock === 1,
  };
}